<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./../template/WorkspaceTemplate.xhtml">

    <ui:define name="top">

    </ui:define>

    <ui:define name="left">

    </ui:define>

    <ui:define name="right">

    </ui:define>

    <ui:define name="content">

        <h:form id="storeSalesOrderForm" style="font-size: 85%">
            <h2>View Raw Material Sales Order</h2>
            <br/>
            <p:panel>
                <p:messages id="messages"/>
                <br/>
                <h:panelGrid columns ="6" cellpadding="10">
                    <h:outputLabel value="Purchase Order Reference: " style="font-weight: bold"/>
                    <h:outputText id="poNumber" value="#{rmsoManagerBean.rmso.rmpo.poNum}"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputLabel value="Sales Order Date: " style="font-weight: bold"/>
                    <h:outputText value="#{rmsoManagerBean.rmso.salesOrderDate}">
                        <f:convertDateTime pattern="MMMM dd, yyyy"/>
                    </h:outputText>

                    <h:outputLabel value="Supplier Id: " style="font-weight: bold"/>
                    <h:outputText id="supplierId" value="#{rmsoManagerBean.rmso.supplier.supplierId}"/>
                    <h:outputText value=""/>
                    <h:outputText value=""/>
                    <h:outputLabel value="Sales Order Number: " style="font-weight: bold"/>
                    <h:outputText value="#{rmsoManagerBean.rmso.salesOrderId}" />

                    <h:outputLabel value="Supplier Name: " style="font-weight: bold"/>
                    <h:outputText id="supplierName" value="#{rmsoManagerBean.rmso.supplier.supplierName}"/>

                </h:panelGrid>

                <br/>
                <br/>
                <br/>
                <h:outputText value="Order Items" style="font-weight: bold; font-size: 110%"/>
                <p:separator/> 
                <br/>
                <p:dataTable id="items" var="rec" rowIndexVar="row" value="#{rmsoManagerBean.rmso.itemlines}" emptyMessage="No items added.">
                    <p:column headerText="S/N" >
                        <h:outputText value="#{row + 1}"/>
                    </p:column>

                    <p:column headerText="Raw Material Item">
                        <h:outputText value="#{rec.rawMaterialSupplyInformation.rawMaterial.name}"/>
                    </p:column>

                    <p:column headerText="Quantity">
                        <h:outputText value="#{rec.qty}"/>
                    </p:column>

                </p:dataTable>

                <br/>
                <br/>
                <br/>
                <h:outputText value="Payment Details" style="font-weight: bold; font-size: 110%"/>
                <p:separator/> 
                <br/>
                <h:panelGrid columns="2" cellpadding="10">
                    <h:outputLabel style="font-weight: bold" value="Currency: "/>
                    <h:outputText value="#{rmsoManagerBean.rmso.currency?'SGD':'USD'}"/>

                    <h:outputLabel style="font-weight: bold" value="Total Amount: "/>
                    <h:outputText value="#{rmsoManagerBean.rmso.total}"/>

                </h:panelGrid>

                <br/>
                <br/>
                <br/>
                <h:outputText value="Raw Material Sales Order File" style="font-weight: bold; font-size: 110%"/>
                <p:separator/> 
                <br/>
                <p:graphicImage value="#{facesContext.externalContext.requestContextPath}/../displayImage?id=#{rmsoManagerBean.rmso.uploadedImage.id}" width="100%"/>

            </p:panel>

            <br/>
            <br/>
            
        </h:form>

    </ui:define>
    
    

    <ui:define name="bottom">

    </ui:define>

</ui:composition>
